package com.bcinfo.iccard.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 常量枚举
 * @author wangguangchun
 *
 */
public  class Constants {
	/**
	 * 消息类型枚举
	 * @author wangguangchun
	 *
	 */
	public enum MsgType{
		signUp(0x0800),signUpResp(0x0810),balanceQuery(0x0100),balanceQueryResp(0x0110),changePwd(0x0801),changePwdResp(0x0811),reversal(0x0400),
		reversalResp(0x0410),refund(0x0500),refundResp(0x0510),saleDebit(0x0200),saleDebitResp(0x0210),revocation(0x0600),revocationResp(0x0610);
		private MsgType(int type){
			this.type=type;
		}
		public final int type;
	}
	public static Map<Integer,Integer> MSG_TYPES=new HashMap<Integer,Integer>();
	static {
		MSG_TYPES.put(MsgType.signUp.type,MsgType.signUpResp.type);
		MSG_TYPES.put(MsgType.balanceQuery.type,MsgType.balanceQuery.type);
		MSG_TYPES.put(MsgType.changePwd.type,MsgType.changePwdResp.type);
		MSG_TYPES.put(MsgType.reversal.type,MsgType.reversalResp.type);
		MSG_TYPES.put(MsgType.refund.type,MsgType.refundResp.type);
		MSG_TYPES.put(MsgType.saleDebit.type,MsgType.saleDebitResp.type);
		MSG_TYPES.put(MsgType.revocation.type,MsgType.revocationResp.type);
	}
	/**
	 * 响应码枚举
	 * @author wangguangchun
	 */
	public enum ResponeCode{
		approval("00"),
		pickupCard("04"),
		donotHonour("05"),
		requestProgressing("09"),
		invalidTransaction("12"),
		invalidAmount("13"),
		invalidCardNum("14"),
		noSuchIssuer("15"),
		reEnterTrans("19"),
		unableToLocateRecord("25"),
		expiredCard("33"),
		suspectFraud("34"),
		cardAcceptorErr("35"),
		lostCard("41"),
		stolenCard("43"),
		declined("51"),
		incorrectPin("55"),
		noCardRecord("56"),
		exceedLimit("61"),//可用余额不足
		timeOut("80"),
		badTerminalId("86"),
		pinKeyErr("87"),
		macKeyErr("88"),
		other("99");
		private ResponeCode(String code){
			this.value=code;
		}
		public final String value;
		
	}
	public enum CardStatus{
	    putIn(0),putOut(1),actived(2),freezed(3),cancelled(4);
	    private CardStatus(int status){
	        this.value=status;
	    }
	    public final int value;
	    
	}
	public enum TradeType{
        cardNoPwd("012"),cardWithPwd("011"),manualNoPwd("022"),manualWithPwd("021"),qrCode("031"),qrCodeTrade("1"),rechargeCardTrade("0");
        private TradeType(String tradeType){
            this.value=tradeType;
        }
        public final String value;
        
    }
	public static final String SYS_M1_READ_KEY="sys.m1.read.key";
	public static final String SYS_PRI_KEY="sys.pri.key";
	public static void main(String[] args) {
		System.out.println(MSG_TYPES.containsKey(0x0800));
		System.out.println(Constants.ResponeCode.approval.value);
	}
}
